package com.ckg.service.impl;

import com.ckg.service.CartService;
import com.ckg.service.InventoryService;
import com.ckg.util.LoggerUtil;

public class CartServiceImpl implements CartService {
    // 注入 InventoryService 和 LoggerUtil
    private InventoryService inventoryService;
    private LoggerUtil loggerUtil;

    public void addToCart(String product) {
        inventoryService.reduceStock();
        loggerUtil.log("添加商品: " + product);
        System.out.println("添加商品: " + product);
    }

    // 补充依赖声明和 setter 方法...
    public void setInventoryService(InventoryService inventoryService) {
        this.inventoryService = inventoryService;
    }

    public void setLoggerUtil(LoggerUtil loggerUtil) {
        this.loggerUtil = loggerUtil;
    }
}
